<?php
/**
 * Created by PhpStorm.
 * User: De Niro
 * Date: 15-4-22
 * Time: 下午5:14
 */
require_once("../api.php");
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    ajaxJSON(false,'method_error');
}else{
    $db = new SQLite3('../chatroom.db');//连接数据库
    $sql = 'select * from user where online = 1';
    $result = $db ->query($sql);
    $resultArray = array();
    while( $row = $result -> fetchArray(SQLITE3_ASSOC) ){
        unset($row['phone']);
        unset($row['password']);
        $row['nickName'] = $row['nickname'];
        $row['iconPath'] = $row['icon_path'];
        unset($row['icon_path']);
        unset($row['nickname']);
        $row['id'] = $row['user_id'];
        unset($row['user_id']);
        unset($row['motto']);
        $row['everTalk'] = false;
        $resultArray[$row['id']] = $row;
    }
    ajaxJSON( true, "success" ,$resultArray);
}